<template>
  <div>
    <p>{{ count }}</p>
  </div>
</template>

<script>
export default {
  name: 'ChildB',
  mounted() {
    this.$globalEventBus.$on('add', this.add)
  },
  beforeDestroy() {
    this.$globalEventBus.$off('add', this.add)
  },
  data() {
    return {
      count: 0,
    }
  },
  methods: {
    add() {
      this.count++
    },
  },
}
</script>

<style></style>
